#ifndef CONTOURCORNERFINDER_H
#define CONTOURCORNERFINDER_H

#include <vector>
#include <opencv2/core/core.hpp>

#include "DataStructures.h"

class ContourCornerFinder
{
public:

    ContourCornerFinder( int width , double minHeight );

    void find( const std::vector<cv::Point> &contour );

    const std::vector<ContourCorner>& getCorners() const;


private:

    double computeIntensity( const std::vector<cv::Point> &contour , int target );
    bool isLocalMin( double *intensity , int N , int target );

    int radius;
    // minimum distance the point needs to be from the line to be a corner
    double minHeightSq;

    std::vector<ContourCorner> corners;

};

#endif // CONTOURCORNERFINDER_H
